//https://leetcode.cn/problems/replace-all-s-to-avoid-consecutive-repeating-characters/
class Solution {
    public String modifyString(String s) {
        char[] ss = s.toCharArray();
        int len = ss.length;
        for (int i = 0; i < len; i++) {
            //替换字符
            if (ss[i] == '?') {
                for (char j = 'a'; j < 'z'; j++) {
                    if ((i == 0 || ss[i - 1] != j) && (i == len - 1 || ss[i + 1] != j) ) {
                        ss[i] = j;
                        break;
                    }
                }
            }
        }
        return String.valueOf(ss);
    }
}